<?php
namespace Admin\Controller;
use Common\Controller\AuthController;

class UsersController extends AuthController
{

    //会员中心
    public function index()
    {

        $area_id=$_SESSION['tc']['area_id'];
        $where['belong_to_area']=$area_id;
        $arr=D('DealerUserinfo')->userList('',$where);
        $this->assign('_list',$arr['list']);
        $this->assign('_page',$arr['page']->show());
        $this->assign('title','会员中心');
        $this->display();
    }
    //更变会员状态
    public function changestatus($id='',$status='')
    {
        if(IS_AJAX){
            if(M('DealerUserinfo')->where("id=%d",$id)->save(['status'=>$status])){
                $this->success('操作成功');
            }else{
                $this->error('操作失败');
            }
        }

    }
    //会员详情
    public function userInfo($id=''){
        if(IS_AJAX){
            $arr=D('DealerUserinfo')->userDetail($id);
            $this->ajaxReturn($arr);
        }
    }
}
